package com.ggqq.service.Impl;

import com.ggqq.dao.UserDao;
import com.ggqq.entity.User;
import com.ggqq.service.UserService;
import com.ggqq.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User checkUser(String username, String password) {
        User user = userDao.findByUsernameAndPassword(username, MD5Utils.code(password));//密码使用md5加密
        return user;
    }

    @Override
    public int insertByUsernameAndPassword(User user) {
        return userDao.insertByUsernameAndPassword(user);
    }

}
